﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//保存绘图对话框
namespace RoadSign
{
    public partial class DialogForm : Form
    {
        public string filename;
        public DialogForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string input = this.textBox1.Text.Trim();
            if (input.Length == 0)
            {
                MessageBox.Show("请输入文件名");
                this.DialogResult = DialogResult.None;
            }
            else if (File.Exists("图形库/" + input + ".dat"))
            {
                MessageBox.Show("存在同名文件，请输入其他文件名");
                this.DialogResult = DialogResult.None;
            }
            else
            {
                this.filename = "图形库/" + input + ".dat";
                this.DialogResult = DialogResult.OK;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
